package StudyCode.summary.mycollection;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;

/**
 * 版权所有 科技与人文(www.tah1986.com)
 */
public class GetCharArrayFromAFile {
	public static void main(String[] argv) throws Exception {
		File file = new File("E:/Copy/1.txt");
		System.out.println(java.util.Arrays.toString(getChars(file)));
	}

	public static char[] getChars(File file) throws IOException {
		String str;

		FileReader reader = new FileReader(file);
		BufferedReader buffer = new BufferedReader(reader);
		String line;
		StringBuilder result = new StringBuilder();
		while ((line = buffer.readLine()) != null) {
			result.append(line).append("\n");
		}
		str = result.toString();
		buffer.close();
		reader.close();

		return str.toCharArray();
	}
}
